Problem Note 56256: Querying a relational DBMS table using the IN clause operator might return unexpected results
Typically, in a relational database management system (RDBMS), nulls represent the absence of data. That is, RDBMS nulls do not sort or compare because there is no data on which to operate. However, in SAS, there is the concept of a missing value, which is quite different.
In SAS, using the IN operator where single quotation marks (‘ ’) are used to represent a null might return unexpected results.
In the following query, SAS passes the WHERE clause as written. This prevents most databases from finding the rows where the variable A was NULL. This happens when the database does not consider a NULL as equal to any value, so rows with NULLS would not be determined to be a match:
SELECT count(b)
FROM m.MISSING1 t1
WHERE t1.A in ('DATA2','');
To work around this issue, rewrite the query to something similar to the following:
SELECT count(b)
FROM m.MISSING1 t1
WHERE t1.A in ('DATA2') or t1.A is null;
Click the Hot Fix tab in this note to access the hot fix for this issue.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Z64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft® Windows® for x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8 Enterprise 32-bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8 Enterprise x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8 Pro 32-bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8 Pro x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8.1 Enterprise 32-bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8.1 Enterprise x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8.1 Pro | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows 8.1 Pro 32-bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2003 Datacenter Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Standard Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 for x64 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2008 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2008 R2 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2008 for x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2012 Datacenter | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2012 R2 Datacenter | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2012 R2 Std | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows Server 2012 Std | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Microsoft Windows XP Professional | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Enterprise 32 bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Enterprise x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Home Premium 32 bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Home Premium x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Professional 32 bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Professional x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Ultimate 32 bit | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows 7 Ultimate x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Windows Vista | 9.3_M2 | | 9.3 TS1M2 | |
Windows Vista for x64 | 9.3_M2 | | 9.3 TS1M2 | |
64-bit Enabled AIX | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
64-bit Enabled HP-UX | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
64-bit Enabled Solaris | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
HP-UX IPF | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Linux | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Linux for x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
Solaris for x64 | 9.3_M2 | 9.4_M3 | 9.3 TS1M2 | 9.4 TS1M3 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Problem Note |
Priority: | high |
Date Modified: | 2015-07-27 14:58:35 |
Date Created: | 2015-07-23 12:49:42 |